package com.example.moblie2021606143cwj0408;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity7 extends AppCompatActivity {

    private TextView tvMainTitle7;
    private TextView tvMain11;
    private TextView tvMain12;
    private TextView tvMain13;
    private EditText edt6;
    private Button btn5;
    private TextView tvResult7;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        initView();
        btn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edt6.getText().toString();
                int num=Integer.valueOf(string).intValue();
                if (num >= 90){
                    tvResult7.setText("A");
                } if (80 <= num&num <= 89){
                    tvResult7 .setText("B");
                } if (70 <= num&num <= 79){
                    tvResult7.setText("C");
                } if (60 <= num&num <= 69){
                   tvResult7.setText("D");
                }if (num<60){
                    tvResult7.setText("E");
                }
            }
        });
    }

    private void initView() {
        tvMainTitle7 = findViewById(R.id.tv_main_title7);
        tvMain11 = findViewById(R.id.tv_main11);
        tvMain12 = findViewById(R.id.tv_main12);
        tvMain13 = findViewById(R.id.tv_main13);
        edt6 = findViewById(R.id.edt6);
        btn5 = findViewById(R.id.btn5);
        tvResult7 = findViewById(R.id.tv_result7);
    }
}